package ogon.autocomplete;

import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.TextView;

public class OgonAutoComplete extends Activity implements TextWatcher{
    /** Called when the activity is first created. */
	TextView selection;
	AutoCompleteTextView edit;
	String[] items = {"preuba","prova","testo","milano","Milano","roma","madrid","londra","New York","newYork"};
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        selection = (TextView)findViewById(R.id.selection);
        edit = (AutoCompleteTextView)findViewById(R.id.search);
        edit.addTextChangedListener(this);
        edit.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line,items));
    }
    public void onTextChanged(CharSequence seq, int start, int before, int count){
    	selection.setText(edit.getText());
    }
	@Override
	public void afterTextChanged(Editable s) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void beforeTextChanged(CharSequence s, int start, int count,
			int after) {
		// TODO Auto-generated method stub
		
	}
}